package com.hanson.common.exception;

import com.hanson.common.api.ResultCode;
import lombok.Getter;
import lombok.ToString;

/**
 * @description: Api接口异常
 * @classname: APIException
 * @author: Hanson
 * @create: 2021/01/08
 **/
@Getter
@ToString
public class APIException extends RuntimeException{

    private ResultCode resultCode;
    private String msg;

    public APIException(){
        this(ResultCode.FAILED,ResultCode.FAILED.getContent());
    }
    public APIException(String msg){
        this.resultCode = ResultCode.FAILED;
        this.msg = msg;
    }
    public APIException(ResultCode resultCode){
        this.resultCode = resultCode;
        this.msg = resultCode.getContent();
    }
    public APIException(ResultCode resultCode, String msg){
        this.msg = msg;
        this.resultCode = resultCode;
    }
}
